package com.explore.demo.controller;


import com.explore.demo.common.ServerResponse;
import com.explore.demo.pojo.CompanyCategory;
import com.explore.demo.pojo.RowView;
import com.explore.demo.service.CompanyCategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gaolainan
 * @since 2021-05-04
 */
@RestController
@RequestMapping("/company_category")
public class CompanyCategoryController {

    @Resource
    private CompanyCategoryService companyCategoryService;

    @GetMapping
    @ApiOperation("查询全部的信息")
    public ServerResponse query(){
        return companyCategoryService.queryAll();
    }

    @PostMapping
    @ApiOperation("创建一个 公司类别")
    public ServerResponse addOne(CompanyCategory companyCategory){
        return companyCategoryService.addCompanyCategory(companyCategory);
    }

    @DeleteMapping
    @ApiOperation("通过id 删除对应的信息")
    public ServerResponse deleteByRecruitId(Integer id){
        return companyCategoryService.deleteById(id);
    }

    @PostMapping("/{companyId}")
    @ApiOperation("根据招聘信息的id 查询对应的类别")
    public ServerResponse queryByUserId(@PathVariable("companyId") Integer companyId){
        return companyCategoryService.queryAllByCompanyId(companyId);
    }
}

